package com.ruijie.acl.service;

import org.springframework.util.Assert;

import com.ruijie.acl.AclDevice;
import com.ruijie.emp.device.Device;
import com.ruijie.foundation.dao.extend.support.HibernateEntityExtendDao;

public class DeviceAclServiceImpl extends HibernateEntityExtendDao<Device> implements DeviceAclService{
	private AclDeviceService aclDeviceService;
	private AclPlanParametersService aclPlanParametersService;
	public AclPlanParametersService getAclPlanParametersService() {
		return aclPlanParametersService;
	}
	public void setAclPlanParametersService(AclPlanParametersService aclPlanParametersService) {
		this.aclPlanParametersService = aclPlanParametersService;
	}
	public AclDeviceService getAclDeviceService() {
		return aclDeviceService;
	}
	public void setAclDeviceService(AclDeviceService aclDeviceService) {
		this.aclDeviceService = aclDeviceService;
	}
	@Override
	public void removeByDevice(Device device) {
		Assert.notNull(device);
		//取得设备对应的ACL设备
		AclDevice aclDevice = aclDeviceService.getByDevice(device);
		if (aclDevice != null){
			//删除ACL设备
			aclDeviceService.remove(aclDevice);
		}
		//删除Parameters
		aclPlanParametersService.removeByDevice(device);
	}
}
